home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / init.d / README
Text File  |  2006-05-08  |  7KB  |  138 lines

  1. mozilla/xpfe/bootstrap/init.d/README
  2.  
  3. This file describes the mechanism for installing and executing
  4. initialization and termination scripts used to implement pluggable
  5. shell scripts to modify the behaviour of SeaMonkey/FireFox/ThunderBird/SunBird.
  6.  
  7. File names in the mozilla/init.d/ and %user_profile%/init.d/
  8. (for example ${HOME}/.mozilla/init.d/ for SeaMonkey) are of the form
  9. [SK]nn<filename> where 'S' means "run this script at application startup",
  10. 'K' means "run this script at application termination", and 'nn' is the
  11. sequence number for killing or starting the job.
  12. When the application (e.g. SeaMonkey) starts scripts prefixed with 'S' are
  13. executed (first those in the app's installation directory, then those in
  14. user's profile directory), on termination those scripts prefixed with 'K'
  15. are being executed (first those in user's profile dir, finally those in
  16. mozilla's installation directory).
  17.  
  18. ** Rules (for Mozilla Pluggable Init Script API Version 2):
  19. * When executing each script a single argument is passed to it - argument
  20.   'stop' for scripts prefixed with 'K' and the argument 'start' for scripts
  21.   prefixed with 'S'.
  22.   An exception of this rule are scripts with the suffix *.sh - they are called
  23.   "inline" in the current shell process which starts/terminates the app. These
  24.   scripts have FULL ACCESS to all variables of the calling script (which means
  25.   these scripts can set/modify/unset environment variables used by the app).
  26.   Since these scripts run in the same shell the author of such scripts should
  27.   ensure that no namespace collisions occur (e.g. accidential modify variable
  28.   names used by the parent script).
  29.  
  30. * Any files which do not match the [SK][0-9][0-9]* pattern are FORBIDDEN
  31.   in ${HOME}/.mozilla/init.d/ and %dist_bin%/init.d/. The only
  32.   exception is this README file.
  33.  
  34. * The following environment variables are defined if ${MOZ_PIS_API} is equal
  35.   or greater than "2" (none of these variables is guranteed to exists before
  36.   API version "2"):
  37.   - "MOZ_PIS_API":
  38.     Integer value describing the version of the "Mozilla Pluggable Init Script
  39.     API". Current version is "2".
  40.   - "MOZ_PIS_MOZBINDIR":
  41.     Relative (!!) or absolute path to the location where the mozilla binary
  42.     is located.
  43.   - "MOZ_PIS_SESSION_PID":
  44.     Process id of the initial application launch script. In this case used as
  45.     session identifier. The value identifies the current application
  46.     session. Note that one user may run multiple application sessions (with
  47.     differnt profiles) in parallel. "stop"-scripts must ensure that they
  48.     only affect resources created by the "start"-script of the same session
  49.     (identified via "MOZ_PIS_SESSION_PID") and same machine (use 'uname -n'
  50.     on demand).
  51.   - "MOZ_PIS_USER_DIR":
  52.     Name of the user dir (e.g. ".mozilla" for Mozilla, ".phoenix" for Phoenix
  53.     etc.)
  54.     The full path to the users profile base directory can be constructed using
  55.     "${HOME}/${MOZ_PIS_USER_DIR}/"
  56.   - "HOME":
  57.     Absolute path to users home directory.
  58.  
  59. * Shell scripts must test the existence of any MOZ_PIS_*-variables before using
  60.   them. It may happen that any of these variables may not exists in a future
  61.   version of this API.
  62.   If any of the requested MOZ_PIS_*-variables is not set the script should print
  63.   an error message to stderr and exit with error code 1.
  64.  
  65. * Mozilla pluggable init shell scripts MUST NOT rely on any other variable names
  66.   than those starting with "MOZ_PIS_";
  67.   "HOME" is the only exception of this rule.
  68.  
  69. * The namespace "MOZ_PIS"/"moz_pis" is reserved for the "Mozilla Pluggable
  70.   Init Script API". Scripts MUST NOT use function names, file names or variable
  71.   name which start with "MOZ_PIS"/"moz_pis".
  72.  
  73. * Scripts ending with *.sh (=scripts called in the same shell process as the
  74.   mozilla startup script) MUST use their own name space for function and
  75.   variable names.
  76.   The usage of single-letter variable names (Example: ${i}) is STRICTLY
  77.   FORBIDDEN!
  78.   This rule does not apply to scripts which operate in their own child process.
  79.  
  80. * Scripts ending with *.sh (=scripts called in the same shell process as the
  81.   mozilla startup script) restricted to the Bourne Shell syntax.
  82.   Any extensions supported by ksh, ksh93, dtksh and bash are FORBIDDEN.
  83.   This restriction does not apply to non-inline shell scripts; they may choose
  84.   their interpreter freely (even #!/usr/bin/perl).
  85.  
  86. * Pluggable shell scripts must have the "readable" and "executable" permission
  87.   bit (e.g. chmod a+rx) set for "user", "group" and "others" when being placed
  88.   in */init.d/
  89.  
  90. * The only allowed way to test whether a mozilla supports the Mozilla Pluggable
  91.   Init Script API is to test for "$dist_bin/init.d/README".
  92.   The following fragment of a XPI install.js script illustrates the test:
  93.   -- snip --
  94.   /* Test whether this mozilla supports pluggable init shell scripts */
  95.   var fProgram           = getFolder("Program");
  96.   var init_d_readme_path = getFolder(fProgram, "init.d/README");
  97.   logComment("# Checking whether '" + init_d_readme_path + "' exists.");
  98.   if (!File.exists(init_d_readme_path)) {
  99.     logComment("# init_d_readme_path missing");
  100.     alert("Your version of Mozilla does not support " +
  101.           "pluggable init shell scripts.\n" + 
  102.           "You need at least Mozilla 1.7a (or later).");
  103.     cancelInstall(ACCESS_DENIED);
  104.     return;
  105.   }
  106.   -- snip --
  107.  
  108. * Scripts must be able to handle that "start" and "stop" are being called
  109.   multiple times (for example when one user works in different profiles).
  110.   The PIS framework provides "MOZ_PIS_SESSION_PID" to identify the current
  111.   running session.
  112.  
  113. * There is no gurantee that "stop"-scripts are being called. The user, admin
  114.   or a reboot may prevent the execution of the "stop" scripts; the "start"
  115.   scripts should include a check to cleanup orphaned resources (orphaned
  116.   resources can simply be identified via checking whether MOZ_PIS_SESSION_PID
  117.   is still a valid PID).
  118.  
  119. * Inline shell scripts are allowed to abort the start sequence with "exit".
  120.   This will PREVENT mozilla from being launched. USE THIS FUNCTIONALITY ONLY
  121.   in EMERGENCY cases or if the user has been asked (GUI etc.) to abort.
  122.   It is STRONGLY recommended to call 'moz_pis_startstop_scripts "stop"' to
  123.   ensure that the "stop"-scripts are being executed (please do not do that
  124.   from "stop" scripts, that will end in an endless loop).
  125.   Example:
  126.   -- snip --
  127.   if [ ! -f "/usr/local/lib/libgtk.so" ] ; then
  128.       echo "${0}: Fatal error: libgtk.so not found." 1>&2
  129.       moz_pis_startstop_scripts "stop"
  130.       exit 1
  131.   fi
  132.   -- snip --
  133.  
  134. ** Rules (for Mozilla Pluggable Init Script API Version 3):
  135. NOT DEFINED YET
  136.  
  137. # EOF.
  138.